package example.github;

import feign.Experimental;

import java.util.concurrent.atomic.AtomicInteger;

public class GitHubStub implements example.github.GitHubExample.GitHub {

    public GitHubInvokations invokations;
    public GitHubAnwsers answers;

    public GitHubStub() {
        this.invokations = new GitHubInvokations();
        this.answers = new GitHubAnwsers();
    }

    @Experimental
    public GitHubStub withRepos(java.util.List<example.github.GitHubExample.GitHub.Repository> repos) {
        answers.reposDefault = repos;
        return this;
    }

    @Override
    public java.util.List<example.github.GitHubExample.GitHub.Repository> repos(java.lang.String owner) {
        invokations.repos.incrementAndGet();

        return answers.reposDefault;
    }

    @Experimental
    public GitHubStub withContributors(java.util.List<example.github.GitHubExample.GitHub.Contributor> contributors) {
        answers.contributorsDefault = contributors;
        return this;
    }

    @Override
    public java.util.List<example.github.GitHubExample.GitHub.Contributor> contributors(java.lang.String owner, java.lang.String repo) {
        invokations.contributors.incrementAndGet();

        return answers.contributorsDefault;
    }

    @Override
    public void createIssue(example.github.GitHubExample.GitHub.Issue issue, java.lang.String owner, java.lang.String repo) {
        invokations.createIssue.incrementAndGet();
    }

    @Experimental
    public class GitHubInvokations {

        private final AtomicInteger repos = new AtomicInteger(0);
        private final AtomicInteger contributors = new AtomicInteger(0);
        private final AtomicInteger createIssue = new AtomicInteger(0);

        public int repos() {
            return repos.get();
        }

        public int contributors() {
            return contributors.get();
        }

        public int createIssue() {
            return createIssue.get();
        }
    }

    @Experimental
    public class GitHubAnwsers {

        private java.util.List<example.github.GitHubExample.GitHub.Repository> reposDefault;

        private java.util.List<example.github.GitHubExample.GitHub.Contributor> contributorsDefault;
    }
}
